import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;

class Fruit<T>{

}
class Apple<T> extends Fruit<T>{

}
public class TestDemo {
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<>(20);
        for (int i = 0; i <list.size() ; i++) {
            System.out.print(list.get(i)+" ");
        }
        for (Integer x:list) {
            System.out.print(x+" ");
        }
        //迭代器
        Iterator<Integer> it=list.iterator();
        while(it.hasNext()){
            System.out.print(it.next()+" ");
        }
    }
    public static void main3(String[] args) {
        MyArrayList myArrayList=new MyArrayList();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.display();
        myArrayList.addPos(5,0);
        myArrayList.display();
        System.out.println(myArrayList.contains(30));
        System.out.println(myArrayList.search(3));
        System.out.println(myArrayList.getPos(9));
        myArrayList.setPos(1,9);
        myArrayList.display();
        myArrayList.remove(9);
        myArrayList.display();
        System.out.println(myArrayList.size());
        myArrayList.clear();
        myArrayList.display();
    }
    public static void main2(String[] args) {
        Integer a=10;
        int b=a;//拆箱
        double c=a;//自动拆箱
        double d=a.doubleValue();//手动拆箱
        System.out.println(d);
    }
    public static void main1(String[] args) {
        int a=10;
        Integer b=a;//10 自动装箱
        Integer c=Integer.valueOf(a);//手动装箱
    }
}
